import Vue from 'vue'
import Vuex from 'vuex'
import axios from 'axios'

Vue.use(Vuex)

export default new Vuex.Store({
  state: {
    goods:[],
  },
  mutations: {
    getData(state,item) {
      state.goods = [...item];
    },
    
  },
  actions: {
    getData(context) {
      axios.get(" http://api.kudesoft.cn/tdk/goods")
      .then(res => {
        console.log(res.data.data.data.list);
        context.commit('getData',res.data.data.data.list)
      })
    }
  },
  modules: {
  }
})
